package com.tiancheng.trade.order.controller.admin;


import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.order.util.DictUtil;
import com.tiancheng.trade.order.vo.admin.KeyValueVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/admin/property")
public class PropertyAdminController {


    /**
     * 数据字典
     *
     * @param type
     * @return
     */
    @GetMapping(value = "/dictionary")
    public Result getDict(@RequestParam(name = "type", required = false) String type) {
        if (StringUtils.isBlank(type)) {
            Map<String, List<KeyValueVO>> all = DictUtil.getDict();
            return Result.success(all);
        }
        List<KeyValueVO> dictVoList = DictUtil.getDict(type);
        return Result.success(dictVoList);

    }
}
